package com.gs.litchi_source

import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.amap.api.location.AMapLocationClient
import com.amap.api.services.core.ServiceSettings
import com.gs.common.API
import com.gs.common.manager.ActivityManager
import com.gs.common.util.OkHttpUtils

class LitchiApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        val context = this

        registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
            override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
                ActivityManager.pushActivity(activity)
            }

            override fun onActivityStarted(activity: Activity) {

            }

            override fun onActivityResumed(activity: Activity) {

            }

            override fun onActivityPaused(activity: Activity) {

            }

            override fun onActivityStopped(activity: Activity) {

            }

            override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {

            }

            override fun onActivityDestroyed(activity: Activity) {
                ActivityManager.popActivity(activity)
            }

        })

        // 定位隐私政策同意
        AMapLocationClient.updatePrivacyShow(context, true, true)
        AMapLocationClient.updatePrivacyAgree(context, true)
        // 搜索隐私政策同意
        ServiceSettings.updatePrivacyShow(context, true, true)
        ServiceSettings.updatePrivacyAgree(context, true)

    }


}